package com.pty.demo.behaviour.command;

import com.google.common.collect.Lists;

import java.util.List;

/**
 * @author pengty
 * @date 2020/3/16
 */
public class ShaXianWaiterInvoker {

    private static List<AbstractOrderCommand> abstractOrderCommandList = Lists.newArrayList();

    public void addCommand(AbstractOrderCommand abstractOrderCommand) {
        System.out.println("添加了一个命令， " + abstractOrderCommand.getClass().getSimpleName());
        abstractOrderCommandList.add(abstractOrderCommand);
    }

    public void executeAll() {
        abstractOrderCommandList.forEach(AbstractOrderCommand::execute);
    }

}
